Socket
Socket
Sign inDemoInstall

bs-logger

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs-logger

Bare simple logger for NodeJS


Version published
Weekly downloads
11M
increased by5.7%
Maintainers
1
Weekly downloads
 
Created

What is bs-logger?

bs-logger is a versatile logging library for Node.js applications. It provides a flexible and configurable logging system that can be easily integrated into various types of projects. The library supports different log levels, custom formats, and transports, making it suitable for both simple and complex logging needs.

What are bs-logger's main functionalities?

Basic Logging

This feature allows you to create a basic logger and log messages at different levels such as info and error.

const { createLogger } = require('bs-logger');
const logger = createLogger();
logger.info('This is an info message');
logger.error('This is an error message');

Custom Log Levels

This feature allows you to set custom log levels, enabling more granular control over what gets logged.

const { createLogger, LogLevels } = require('bs-logger');
const logger = createLogger({ level: LogLevels.debug });
logger.debug('This is a debug message');
logger.warn('This is a warning message');

Custom Transports

This feature allows you to configure multiple transports for logging, such as logging to both console and files.

const { createLogger, transports } = require('bs-logger');
const logger = createLogger({
  transports: [
    new transports.Console(),
    new transports.File({ filename: 'combined.log' })
  ]
});
logger.info('This message will be logged to both console and file');

Custom Formats

This feature allows you to define custom formats for your log messages, making it easier to read and analyze logs.

const { createLogger, format } = require('bs-logger');
const logger = createLogger({
  format: format.combine(
    format.timestamp(),
    format.printf(({ level, message, timestamp }) => {
      return `${timestamp} [${level}]: ${message}`;
    })
  )
});
logger.info('This is a formatted info message');

Other packages similar to bs-logger

Keywords

FAQs

Package last updated on 10 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc